package snippet;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class T500 {
	public static void main(String[] args) {
		//System.out.println("abc".indexOf('2'));
		String s[] = { "Hello", "Alaska", "Dad", "Peace" };
		System.out.println(Arrays.toString(new T500().findWords(s)));

	}

	public String[] findWords(String[] words) {	
		List<String> list = new ArrayList<>();
		for (int i = 0; i < words.length; i++) {
			int n =get (words[i].charAt(0));
			boolean f=true;
			for (int j = 1; j < words[i].length(); j++) {
				if(get(words[i].charAt(j))!=n) {
					f=false;
					break;
				}
			}
			if(f) {
				list.add(words[i]);
			}
		}
		String[] arr = new String[list.size()];
		return list.toArray(arr);

	}
	public int get(char s) {
		
		
		if(a1.indexOf(s)!=-1) {
			return 1;
		}else if(a2.indexOf(s)!=-1) {
			return 2;
		}else {
			return 3;
		}
	}
	String a1 = "QWERTYUIOPqwertyuiop";
	String a2 = "ASDFGHJKLasdfghjkl";
	String a3 = "ZXCVBNMzxcvbnm";
}
